package com.tool.write.medile;

import com.alibaba.excel.EasyExcel;
import com.tool.write.entity.Student;

import java.util.ArrayList;
import java.util.List;

/**
 * @author niuyicong
 * @date 2024/10/19  17:38:30
 * @description 复杂表头导出
 */
public class HardTitleWrite {
    public static void main(String[] args) {
        String fileName = "学生成绩单" + System.currentTimeMillis() + ".xlsx";

        EasyExcel.write(fileName, Student.class)
                .sheet("成绩单")
                .doWrite(() -> {
                    return data();
                });
    }

    public static List<Student> data(){
        List<Student> data = new ArrayList<>();
        Student student1 = new Student("100.00","90.00","60.00");
        Student student2 = new Student("100.00","90.00","60.00");
        Student student3 = new Student("100.00","90.00","60.00");
        data.add(student1);
        data.add(student2);
        data.add(student3);
        return data;
    }
}
